/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.rakev.matcher.builder;

import java.util.Collection;
import ru.rakev.producer.Producer;
import ru.rakev.matcher.Matcher;
import ru.rakev.producer.builder.CollectionProducerBuilder;
import ru.rakev.producer.builder.CompositeProducerBuilder;

/**
 *
 * @author Rakev
 */
public class CollectionMatcherBuilder<F, C extends Collection<E>, E> extends ObjectMatcherBuilder<F, C> {

    public static <C extends Collection<E>, E> CollectionMatcherBuilder<C, C, E> create() {
        return new CollectionMatcherBuilder<>(CollectionProducerBuilder.<C, E>create());
    }

    public CollectionMatcherBuilder(CompositeProducerBuilder<F, C> producerBuilder) {
        super(producerBuilder);
    }

    public Matcher<F> anyOf(Matcher<E> elementMatcher) {
        Producer<F, C> collectionProducer = getProducerBuilder().build();
        return getProducerMatcherAdapterFactory().<F, C, E>createAnyOf(collectionProducer, elementMatcher);
    }
}
